{extend name="share:layout"/}
{block name="title"}表单生成 - 步骤2 - 完成{/block}

{block name="body"}
<h3>表单生成 - 步骤2 - 完成<small>对应控制器中的(add、edit)方法</small></h3>
{php}if($style=='h'){echo '水平表单:标题和文本框左右结构';}else if($style=='b'){echo '基本表单:标题和文本框上下结构';}else if($style=='i'){echo '内联表单:所有项目在一行显示（登录功能常用）';}{/php}
<br>
<font color="red" size="-2">{$msg ?? ''}</font><br>
<textarea id="code" name="code" class="form-control" style="height:360px;" readonly="readonly" onclick="code.focus();code.select();">

<?php if($style=='h'){ ?>

<form class="form-horizontal" action="{literal}{:url('save')}{/literal}" method="post">
<input type="hidden" name="{$key}" id="{$key}" value="{literal}{$m.{/literal}{$key} ?? ''}">
 {volist name="cls" id="vi"}
 {if condition="$vi['Key'] neq 'PRI'"}
  <div class="form-group">
    <label for="{$vi.Field}" class="col-sm-2 control-label">{$vi.Comment ?? $vi.Field}</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="{$vi.Field}" name="{$vi.Field}" placeholder="{$vi.Comment}" value="{literal}{$m.{/literal}{$vi.Field} ?? ''}">
    </div>
  </div>
  {/if}
  {/volist}
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <input type="submit" class="btn btn-default" value="提交"/>
    </div>
  </div>
</form>


<?php }else if($style=='b'){ ?>

<form action="{literal}{:url('save')}{/literal}" method="post">
<input type="hidden" name="{$key}" id="{$key}" value="{literal}{$m.{/literal}{$key} ?? ''}">
{volist name="cls" id="vi"}
{if condition="$vi['Key'] neq 'PRI'"}
  <div class="form-group">
    <label for="{$vi.Field}">{$vi.Comment ?? $vi.Field}</label>
    <input type="text" class="form-control" id="{$vi.Field}" name="{$vi.Field}" placeholder="{$vi.Comment}" value="{literal}{$m.{/literal}{$vi.Field} ?? ''}">
  </div>
{/if}
{/volist}
  <input type="submit" class="btn btn-default" value="提交"/>
</form>

<?php }else if($style=='i'){ ?>

<form class="form-inline" action="{literal}{:url('save')}{/literal}" method="post">
<input type="hidden" name="{$key}" id="{$key}" value="{literal}{$m.{/literal}{$key} ?? ''}">
{volist name="cls" id="vi"}
{if condition="$vi['Key'] neq 'PRI'"}
  <div class="form-group">
    <label for="{$vi.Field}">{$vi.Comment ?? $vi.Field}</label>
    <input type="text" class="form-control" id="{$vi.Field}" name="{$vi.Field}" placeholder="{$vi.Comment}" value="{literal}{$m.{/literal}{$vi.Field} ?? ''}">
  </div>
 {/if}
 {/volist} 

  <button type="submit" class="btn btn-default">保存</button>
</form>

<?php } ?>


</textarea>

<a href="javascript:var h=$('#code').val();$('#run').html(h);$('#run').toggle();">查看效果</a>
<div id="run" style="display:none;"></div>
{/block}